package shmallarchitect.jpa.entities;
// Generated 2009-08-23 21:22:13 by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * Category generated by hbm2java
 */
@Entity
@Table(name="category"
    ,catalog="shmall_architect"
)
public class Category  implements java.io.Serializable {


     private Long id;
     private String name;
     private Set<Locum> locums = new HashSet<Locum>(0);

    public Category() {
    }

	
    public Category(String name) {
        this.name = name;
    }
    public Category(String name, Set<Locum> locums) {
       this.name = name;
       this.locums = locums;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="id", unique=true, nullable=false)
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="name", nullable=false)
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
@ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @JoinTable(name="locumcategory", catalog="shmall_architect", joinColumns = { 
        @JoinColumn(name="category_id", nullable=false, updatable=false) }, inverseJoinColumns = { 
        @JoinColumn(name="locum_id", nullable=false, updatable=false) })
    public Set<Locum> getLocums() {
        return this.locums;
    }
    
    public void setLocums(Set<Locum> locums) {
        this.locums = locums;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Category other = (Category) obj;
        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        return hash;
    }

    @Override
    public String toString() {
        return name;
    }




}


